package com.justgame.project.base.config;

import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;

import javax.annotation.Resource;

/**
 * 定时任务异步线程池
 */
public class SchedulingConfig implements SchedulingConfigurer {

    @Resource
    private ThreadPoolConfig threadPoolConfig;

    @Override
    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
        taskRegistrar.setScheduler(threadPoolConfig.taskExecutor());
    }
}
